package com.jt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jt.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

//@Mapper //为接口创建了反射机制的一个对象
// extends BaseMapper<User>
public interface UserMapper  extends BaseMapper<User>{
    //查询全部用户信息 访问修饰符 返回值类型 方法名(参数...)
    @Select("select * from demo_user")
    List<User> findAll();

    @Insert("insert into demo_user(id,name,age,sex) value (#{id},#{name},#{age},#{sex})")
    void insertUser(User user);

    @Update("update demo_user set name=#{newName} where name=#{oldName}")
    void updateByName(String oldName, String newName);

    @Delete("delete from demo_user where name=#{name}")
    void deleteByName(String name);
   /* void insertUser(User user);
    void updateUser(String oldname,String newname,String sex);
    void deleteUser(Integer id);*/

}
